package com.example.zzl.view.fragment.ShareOrderFragment.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.example.zzl.R;
import com.example.zzl.view.fragment.ShareOrderFragment.model.Infor;

import java.util.List;


/**
 * Created by Administrator on 2017/2/12.
 */
public class TuAdapter extends BaseAdapter{
    private Context context;
    private List<Infor.ImageTagsBean> list;

    public TuAdapter(Context context, List<Infor.ImageTagsBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        if (convertView==null){
            vh=new ViewHolder();
            convertView=View.inflate(context, R.layout.iv,null);
            vh.iv=(ImageView)convertView.findViewById(R.id.justiv);
            convertView.setTag(vh);
        }else {
            vh=(ViewHolder)convertView.getTag();
        }
        Glide.with(context).load(list.get(position).imgname).into(vh.iv);

        return convertView;
    }
    class ViewHolder{
        ImageView iv;
    }
}
